package com.hckjsec.system.service.impl;

import java.util.List;

import com.hckjsec.common.utils.uuid.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hckjsec.system.mapper.WorkOaApplyMapper;
import com.hckjsec.system.domain.WorkOaApply;
import com.hckjsec.system.service.IWorkOaApplyService;

/**
 * 日常申请Service业务层处理
 * 
 * @author cyt
 * @date 2021-06-28
 */
@Service
public class WorkOaApplyServiceImpl implements IWorkOaApplyService 
{
    @Autowired
    private WorkOaApplyMapper workOaApplyMapper;

    @Autowired
    private IdWorker idWorker;

    /**
     * 查询日常申请
     * 
     * @param applyId 日常申请ID
     * @return 日常申请
     */
    @Override
    public WorkOaApply selectWorkOaApplyById(Long applyId)
    {
        return workOaApplyMapper.selectWorkOaApplyById(applyId);
    }

    /**
     * 查询日常申请列表
     * 
     * @param workOaApply 日常申请
     * @return 日常申请
     */
    @Override
    public List<WorkOaApply> selectWorkOaApplyList(WorkOaApply workOaApply)
    {
        return workOaApplyMapper.selectWorkOaApplyList(workOaApply);
    }

    /**
     * 新增日常申请
     * 
     * @param workOaApply 日常申请
     * @return 结果
     */
    @Override
    public int insertWorkOaApply(WorkOaApply workOaApply)
    {
        workOaApply.setApplyNumber(idWorker.nextId());
        return workOaApplyMapper.insertWorkOaApply(workOaApply);
    }

    /**
     * 修改日常申请
     * 
     * @param workOaApply 日常申请
     * @return 结果
     */
    @Override
    public int updateWorkOaApply(WorkOaApply workOaApply)
    {
        return workOaApplyMapper.updateWorkOaApply(workOaApply);
    }

    /**
     * 批量删除日常申请
     * 
     * @param applyIds 需要删除的日常申请ID
     * @return 结果
     */
    @Override
    public int deleteWorkOaApplyByIds(Long[] applyIds)
    {
        return workOaApplyMapper.deleteWorkOaApplyByIds(applyIds);
    }

    /**
     * 删除日常申请信息
     * 
     * @param applyId 日常申请ID
     * @return 结果
     */
    @Override
    public int deleteWorkOaApplyById(Long applyId)
    {
        return workOaApplyMapper.deleteWorkOaApplyById(applyId);
    }
}
